﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AppFramework.Migrations
{
    public partial class ModelAdd : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "tb_BillOfMaterial",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Numberbom = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Versionnumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Productname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Productnumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Productmodel = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Defaultbom = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Dailyproduction = table.Column<int>(type: "int", nullable: false),
                    Parentid = table.Column<int>(type: "int", nullable: false),
                    Processnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_BillOfMaterial", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_BillOfMaterialDetails",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Numberbom = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Materialnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Usageamount = table.Column<int>(type: "int", nullable: false),
                    Useratio = table.Column<int>(type: "int", nullable: false),
                    Accessorytype = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_BillOfMaterialDetails", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_CodingRule",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TargetForm = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    CodingName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    CodingProd = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    TimeRule = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    GenerateType = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    InitialNumber = table.Column<int>(type: "int", nullable: false),
                    InitialLong = table.Column<int>(type: "int", nullable: false),
                    StepSize = table.Column<int>(type: "int", nullable: false),
                    CodingGenerateRule = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
                    CodingPreview = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
                    Current_Number = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Createld = table.Column<int>(type: "int", nullable: true),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Createdate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Modifyid = table.Column<int>(type: "int", nullable: true),
                    Modifydate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Modifier = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Isdelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_CodingRule", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_Codingrules",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TargetForm = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    CodingName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    CodingProd = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    TimeRule = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    GenerateType = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    InitialNumber = table.Column<int>(type: "int", nullable: false),
                    InitialLong = table.Column<int>(type: "int", nullable: false),
                    StepSize = table.Column<int>(type: "int", nullable: false),
                    CodingGenerateRule = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
                    CodingPreview = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
                    Current_Number = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_Codingrules", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_CraftProcess",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Serialnumber = table.Column<int>(type: "int", nullable: false),
                    Craftcode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Process = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Nextprocess = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Relation = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Keyprocess = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Showcolor = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Readinesstime = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Waitingtime = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_CraftProcess", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_CraftRoute",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Routecoded = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Routename = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Routestate = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Routeexplain = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Routeremark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_CraftRoute", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_dictionaries",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Dictionariesname = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Sort = table.Column<int>(type: "int", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_dictionaries", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_material",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Materialnumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Specificationsversion = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Materialtype = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    MaterialProperty = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Materialclassify = table.Column<int>(type: "int", nullable: false),
                    State = table.Column<bool>(type: "bit", nullable: false),
                    Periodofvalidity = table.Column<int>(type: "int", nullable: true),
                    Periodofvalidityunit = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Alarmdays = table.Column<int>(type: "int", nullable: true),
                    Inventoryceiling = table.Column<int>(type: "int", nullable: true),
                    Stockfloor = table.Column<int>(type: "int", nullable: true),
                    Purchaseprice = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_material", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_materialproductimg",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Filename = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Filepath = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Filetype = table.Column<int>(type: "int", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_materialproductimg", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_MaterialRequisition",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Materialrequisitionname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Materialrequisitioncode = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Materialrequisitiondate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Person = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Workordername = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Workordercode = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Taskname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Taskcode = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Processroute = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Processname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    State = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_MaterialRequisition", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_MaterialRequisitionBOM",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Serialnumber = table.Column<int>(type: "int", nullable: false),
                    Materialrequisitioncode = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Materialname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Materialcode = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
                    Specificationsandmodels = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Unit = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    Stock = table.Column<int>(type: "int", nullable: false),
                    Number = table.Column<int>(type: "int", nullable: false),
                    Batchnumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Warehousename = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Storagelocationname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Reservoirareaname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_MaterialRequisitionBOM", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_materialtype",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Pid = table.Column<int>(type: "int", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_materialtype", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_Process",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Processname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Processcode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Processstate = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Processexplain = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Processremark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_Process", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_ProcessMaterial",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Processnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Procedurenumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Materialnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_ProcessMaterial", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_ProductClassification",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Classname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Fatherid = table.Column<int>(type: "int", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_ProductClassification", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_Productinfo",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Productid = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Productname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Specification = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Units = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Producttype = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Productproperty = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Productclassid = table.Column<int>(type: "int", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false),
                    Periodofvalidity = table.Column<int>(type: "int", nullable: false),
                    Date = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Numberday = table.Column<int>(type: "int", nullable: false),
                    Inventoryceiling = table.Column<int>(type: "int", nullable: false),
                    Stockfloor = table.Column<int>(type: "int", nullable: false),
                    Purchaseprice = table.Column<decimal>(type: "decimal", nullable: false),
                    Saleprice = table.Column<decimal>(type: "decimal", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_Productinfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_ProductionPlanning",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Planningnumber = table.Column<string>(type: "varchar(40)", nullable: false, comment: "计划编号"),
                    Planningname = table.Column<string>(type: "varchar(20)", nullable: false, comment: "计划名称"),
                    Sourcetype = table.Column<string>(type: "varchar(20)", nullable: true, comment: "来源类型"),
                    Ordernumber = table.Column<string>(type: "varchar(40)", nullable: false, comment: "订单编号"),
                    Finishedname = table.Column<string>(type: "varchar(20)", nullable: false, comment: "成品名称"),
                    Finishednumber = table.Column<string>(type: "varchar(40)", nullable: false, comment: "成品编号"),
                    Specificationversion = table.Column<string>(type: "varchar(20)", nullable: true, comment: "规格型号"),
                    Finishedtype = table.Column<string>(type: "varchar(20)", nullable: true, comment: "成品l类型"),
                    Unit = table.Column<string>(type: "varchar(20)", nullable: true, comment: "单位"),
                    Planningcount = table.Column<int>(type: "int", nullable: true, comment: "计划数量"),
                    Starttime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Timeofcompletion = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Demanddate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Remark = table.Column<string>(type: "varchar(200)", nullable: true, comment: "备注"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    BOMNumber = table.Column<string>(type: "varchar(40)", nullable: false, comment: "BOMb编号"),
                    State = table.Column<int>(type: "int", nullable: false, comment: "状态"),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_ProductionPlanning", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_ProductionWordOrder",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ExplainNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    WorkOrderNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    WorkOrderName = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    WorkOrderSchedule = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    RelevanceExplain = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    ProductName = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    ProductNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Specification = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    ProductType = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    Unit = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    DemandDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    ExplainNum = table.Column<int>(type: "int", nullable: false),
                    AccomplishNum = table.Column<int>(type: "int", nullable: false),
                    ExplainStartDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    ExplainEndDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    PracticalStartDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    PracticalEndDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    State = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    Createld = table.Column<int>(type: "int", nullable: true),
                    Creator = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Createdate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Modifyid = table.Column<int>(type: "int", nullable: true),
                    Modifydate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Modifier = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Isdelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_ProductionWordOrder", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_SendWorkinfo",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Classid = table.Column<int>(type: "int", nullable: false),
                    Classprincipal = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Othermembers = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Taskremark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Departmentid = table.Column<int>(type: "int", nullable: false),
                    Departmentname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Qualitytestingremark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_SendWorkinfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_TeamorGroupinfo",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Classname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Classencoding = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Classtype = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Principal = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Number = table.Column<int>(type: "int", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_TeamorGroupinfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_TicketTaskinfo",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Missionnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Taskname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Sitename = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Stationnumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Technologicalprocess = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Processname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Procedurenumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Plannedquantity = table.Column<int>(type: "int", nullable: false),
                    Realquantity = table.Column<int>(type: "int", nullable: false),
                    Runplantdate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Completedate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Plannedproductiontime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Actualproductiontime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    States = table.Column<int>(type: "int", nullable: false),
                    Workordernumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_TicketTaskinfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_dictionariesList",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Text = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Sort = table.Column<int>(type: "int", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DictionariesId = table.Column<int>(type: "int", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_dictionariesList", x => x.Id);
                    table.ForeignKey(
                        name: "FK_tb_dictionariesList_tb_dictionaries_DictionariesId",
                        column: x => x.DictionariesId,
                        principalTable: "tb_dictionaries",
                        principalColumn: "Id");
                });

            migrationBuilder.CreateIndex(
                name: "IX_tb_BillOfMaterial_Versionnumber_Numberbom_Productname_Productmodel_Productnumber",
                table: "tb_BillOfMaterial",
                columns: new[] { "Versionnumber", "Numberbom", "Productname", "Productmodel", "Productnumber" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_CraftRoute_Routecoded_Routename",
                table: "tb_CraftRoute",
                columns: new[] { "Routecoded", "Routename" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_CraftRoute_Routestate",
                table: "tb_CraftRoute",
                column: "Routestate");

            migrationBuilder.CreateIndex(
                name: "IX_tb_dictionariesList_DictionariesId",
                table: "tb_dictionariesList",
                column: "DictionariesId");

            migrationBuilder.CreateIndex(
                name: "IX_tb_material_Materialclassify",
                table: "tb_material",
                column: "Materialclassify");

            migrationBuilder.CreateIndex(
                name: "IX_tb_material_MaterialProperty",
                table: "tb_material",
                column: "MaterialProperty");

            migrationBuilder.CreateIndex(
                name: "IX_tb_material_Name_Materialtype_State",
                table: "tb_material",
                columns: new[] { "Name", "Materialtype", "State" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_MaterialRequisition_Materialrequisitiondate",
                table: "tb_MaterialRequisition",
                column: "Materialrequisitiondate");

            migrationBuilder.CreateIndex(
                name: "IX_tb_MaterialRequisition_Materialrequisitionname_Materialrequisitioncode",
                table: "tb_MaterialRequisition",
                columns: new[] { "Materialrequisitionname", "Materialrequisitioncode" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_MaterialRequisition_Workordername_Workordercode",
                table: "tb_MaterialRequisition",
                columns: new[] { "Workordername", "Workordercode" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_Process_Processcode",
                table: "tb_Process",
                column: "Processcode");

            migrationBuilder.CreateIndex(
                name: "IX_tb_Process_Processname_Processstate",
                table: "tb_Process",
                columns: new[] { "Processname", "Processstate" });

            migrationBuilder.CreateIndex(
                name: "IX_tb_Productinfo_Productclassid",
                table: "tb_Productinfo",
                column: "Productclassid");

            migrationBuilder.CreateIndex(
                name: "IX_tb_Productinfo_Productid",
                table: "tb_Productinfo",
                column: "Productid");

            migrationBuilder.CreateIndex(
                name: "IX_tb_Productinfo_Productproperty",
                table: "tb_Productinfo",
                column: "Productproperty");

            migrationBuilder.CreateIndex(
                name: "IX_tb_Productinfo_Producttype",
                table: "tb_Productinfo",
                column: "Producttype");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "tb_BillOfMaterial");

            migrationBuilder.DropTable(
                name: "tb_BillOfMaterialDetails");

            migrationBuilder.DropTable(
                name: "tb_CodingRule");

            migrationBuilder.DropTable(
                name: "tb_Codingrules");

            migrationBuilder.DropTable(
                name: "tb_CraftProcess");

            migrationBuilder.DropTable(
                name: "tb_CraftRoute");

            migrationBuilder.DropTable(
                name: "tb_dictionariesList");

            migrationBuilder.DropTable(
                name: "tb_material");

            migrationBuilder.DropTable(
                name: "tb_materialproductimg");

            migrationBuilder.DropTable(
                name: "tb_MaterialRequisition");

            migrationBuilder.DropTable(
                name: "tb_MaterialRequisitionBOM");

            migrationBuilder.DropTable(
                name: "tb_materialtype");

            migrationBuilder.DropTable(
                name: "tb_Process");

            migrationBuilder.DropTable(
                name: "tb_ProcessMaterial");

            migrationBuilder.DropTable(
                name: "tb_ProductClassification");

            migrationBuilder.DropTable(
                name: "tb_Productinfo");

            migrationBuilder.DropTable(
                name: "tb_ProductionPlanning");

            migrationBuilder.DropTable(
                name: "tb_ProductionWordOrder");

            migrationBuilder.DropTable(
                name: "tb_SendWorkinfo");

            migrationBuilder.DropTable(
                name: "tb_TeamorGroupinfo");

            migrationBuilder.DropTable(
                name: "tb_TicketTaskinfo");

            migrationBuilder.DropTable(
                name: "tb_dictionaries");
        }
    }
}
